package hr.functional.steps;

import cucumber.annotation.en.Given;
import cucumber.annotation.en.Then;
import cucumber.annotation.en.When;
import cucumber.runtime.PendingException;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;

/**
 * Created with IntelliJ IDEA.
 * User: VMoskalenko
 * Date: 22.06.12
 * Time: 16:12
 */
public class HrSteps {

    private WebDriver driver;
    private WebElement element;

    @Given("^I have accessed HR system create page$")
    public void I_have_accessed_HR_system_create_page() {
        driver = new HtmlUnitDriver();
        driver.get("http://localhost:8888/hr/person/create");
    }

    @When("^click the \"([^\"]*)\" button$")
    public void click_the_button(String buttonName) {
        element = driver.findElement(By.name(buttonName));
        element.submit();
    }

    @When("^I enter \"([^\"]*)\" in \"([^\"]*)\" field on create page$")
    public void I_enter_in_field_on_create_page(String value, String fieldName) {
        element = driver.findElement(By.name(fieldName));
        element.sendKeys(value);
    }


    @Then("^stuff result list contains \\(\"([^\"]*)\", \"([^\"]*)\", \"([^\"]*)\", \"([^\"]*)\"\\)$")
    public void stuff_result_list_contains_(String arg1, String arg2, String arg3, String arg4) {
        // Express the Regexp above with the code you wish you had
        throw new PendingException();
    }

    @Then("^link to create new person$")
    public void link_to_create_new_person() {
        // Express the Regexp above with the code you wish you had
        throw new PendingException();
    }

}
